﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using FBroSharp.DataType;
using FBroSharp;
using FBroSharp.Value;

namespace _006创建后台浏览器
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            CreateBrowser();
        }
        public void CreateBrowser()
        {
            string url = "https://www.baidu.com";
   
            BrowserEvent browser_event = new BrowserEvent();
            //普通创建浏览器
            //FBroSharpControl.CreatBrowser(url, windowsInfo, default, default, default, browser_event, default);

            //创建后台浏览器
            FBroSharpDictionaryValue FBroDict = new FBroSharpDictionaryValue();
            FBroDict.SetBool("是否为后台", true);
            FBroSharpControl.CreateBackground(url, default, default, FBroDict, browser_event, default);

        }

        private void ButtonClick(object sender, EventArgs e)
        {
            Button btn = (Button)sender;
            if (btn == button1)
            {
                MessageBox.Show(BackGroundBrowserList.data[0].GetMainFrame().GetURL());

            }
            else if (btn == button2)
            { 
                //跳转网址
               BackGroundBrowserList.data[0].GetMainFrame().LoadURL(textBox1.Text);
            }
        }
    }
}
